function getcircular() {
  $.ajax({
    url: baseUrl + "/topType",
    type: "POST",
    dataType: "json",
    success: function (data) {
        // console.log(data.data,'fdfffffffffffff');
      circularData(data.data);
        
    },
    // 超时时间
    timeout: 4000,
    // 失败的回调
    error: function () {
      // alert("圆形统计图请求数据失败！");
    },
  });
}
function circularData(res) {
  var data = res
  
  var titleArr= [], seriesArr=[];
  colors=[['#389af4', '#dfeaff'],['#ff8c37', '#ffdcc3'],['#ffc257', '#ffedcc'], ['#fd6f97', '#fed4e0'],['#a181fc', '#e3d9fe'],['#a181fc', '#e3d9fe']]
  data.forEach(function(item, index){
      titleArr.push(
          {
              text:item.type_name,
              left: index * 20 + 9.5 +'%',
              top: '90%',
              textAlign: 'center',
              textStyle: {
                  fontWeight: 'normal',
                  fontSize: '16',
                  color: colors[index][0],
                  textAlign: 'center',
              },
          }        
      );
      seriesArr.push(
          {
              name: item.type_name,
              type: 'pie',
              clockWise: false,
              radius: [60, 70],
              itemStyle:  {
                  normal: {
                      color: colors[index][0],
                      shadowColor: colors[index][0],
                      shadowBlur: 0,
                      label: {
                          show: false
                      },
                      labelLine: {
                          show: false
                      },
                  }
              },
              hoverAnimation: false,
              center: [index * 20 + 10 +'%', '50%'],
              data: [{
                  value: item.rate,
                  label: {
                      normal: {
                          formatter: function(params){
                              return params.value+'%';
                          },
                          position: 'center',
                          show: true,
                          textStyle: {
                              fontSize: '20',
                              fontWeight: 'bold',
                              color: colors[index][0]
                          }
                      }
                  },
              }, {
                  value: 100-item.rate,
                  name: 'invisible',
                  itemStyle: {
                      normal: {
                          color: colors[index][1]
                      },
                      emphasis: {
                          color: colors[index][1]
                      }
                  }
              }]
          }    
      )
  });
 
  
  option = {
    backgroundColor: "#161E31",
    title:titleArr,
    series: seriesArr
  }
  // 为echarts对象加载数据
//   console.log(option ,'option ');
  myChartc = echarts.init(document.getElementById("circular"));
  myChartc.setOption(option);
}
//假设实例的名字是myChart,在echats配置完实例以后,配置下面几行代码即可
window.onresize = function () {
  myChartc.resize();
};
